﻿using AspectCore.DynamicProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleAppAOPModule
{
   public class CustomFileterAttribute: AbstractInterceptorAttribute
    {
        public async override Task Invoke(AspectContext context, AspectDelegate next)
        {
            try
            {
                Console.WriteLine("AOP 方法执行前");
                await next(context);
            }
            catch (Exception ex)
            {

                Console.WriteLine($"执行方法时出错：{ex.Message}");
            }
            finally
            {
                Console.WriteLine("AOP 方法执行结束");
            }
        }
    }
}
